//
//  GameOverScene.m
//  SpeedTap
//
//  Created by Chi Ho Chiu on 28/8/11.
//  Copyright 2011 Individual. All rights reserved.
//

#import "GameOverScene.h"
#import "GameManager.h"

@implementation GameOverScene
@synthesize layer;

-(id) init
{
    if( (self = [super init]) )
    {
        [[GameManager sharedGameManager] setGameState:kGAME_STATE_GAME_OVER];
        CCLOG(@"GameState: kGAME_STATE_GAME_OVER");
        
        [self setLayer:[GameOverLayer node]];
        [layer setDelegate:self];
        [self addChild:layer];
    }
    
    return self;
}

-(void) dealloc
{
    [layer release];
    [super dealloc];
}

-(void) onRetryItemClicked
{
    int iCurrentLevel = [[GameManager sharedGameManager] currentLevel];
    [[GameManager sharedGameManager] replaceScene:(EGameScene)iCurrentLevel];
}

-(void) onExitItemClicked
{
    [[GameManager sharedGameManager] replaceScene:kGAME_SCENE_MAIN_MENU];    
}

@end
